package com.jxt.myjxtmanager.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;


import com.jxt.myjxtmanager.R;
import com.jxt.myjxtmanager.entity.SearchTypeBean;

import java.util.List;

/**
 * Created by Administrator on 2016/10/24 0024.
 */
public class SearchTypeAdapter extends BaseAdapter {
    private List<SearchTypeBean> list;
    private Context context;
    public SearchTypeAdapter(Context context, List<SearchTypeBean> list){
        this.context=context;
        this.list=list;
    }
    @Override
    public int getCount() {
        return list.size()==0 ? 0 : list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView= LayoutInflater.from(context).inflate(R.layout.searchtype_lv_item,parent,false);
            convertView.setTag(new ViewHolder(convertView));
        }
        ViewHolder mHolder=(ViewHolder)convertView.getTag();
        mHolder.left_item_name.setText(list.get(position).getType_name());
        return convertView;
    }
    class ViewHolder{
        private TextView left_item_name;
        public ViewHolder(View view){
            left_item_name = ((TextView) view.findViewById(R.id.left_item_name));
        }
    }
}
